<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>操作属性</button>
    <div id="box" hello="world"> div 标签</div>
    <input type="password">

    <script>

        var box = document.querySelector('div')
        var inp = document.querySelector('input')
        var btn = document.querySelector('button')
        // console.log(box,inp,btn);
        // btn.onclick = function(){
        //     box.id = 'content'
        //     inp.type = 'checkbox'
        // }

        //修改自定义属性
        var res = box.getAttribute("hello")
        console.log(res);
        btn.onclick = function(){
            box.setAttribute('hello','sssss')
            // alert("sss")
        }

    


    </script>
    
</body>
</html>